home *** CD-ROM | disk | FTP | other *** search
/ Planet Source Code Jumbo …e CD Visual Basic 1 to 7 / 6_2008-2009.ISO / data / zips / jcMDITabs_2151044302009.psc / jcMDItabs v1.2 / jcMDITabs / CMemoryDC.cls < prev   
Text File  |  2009-04-09  |  59KB  |  1,350 lines

  1. VERSION 1.0 CLASS
  2. BEGIN
  3.   MultiUse = -1  'True
  4.   Persistable = 0  'NotPersistable
  5.   DataBindingBehavior = 0  'vbNone
  6.   DataSourceBehavior  = 0  'vbNone
  7.   MTSTransactionMode  = 0  'NotAnMTSObject
  8. END
  9. Attribute VB_Name = "CMemoryDC"
  10. Attribute VB_GlobalNameSpace = False
  11. Attribute VB_Creatable = True
  12. Attribute VB_PredeclaredId = False
  13. Attribute VB_Exposed = False
  14.  
  15. '*******************************************************************************
  16. '*    Component   : CMemoryDC
  17. '*    Description : Memory device contex drawing class used for flicker-free
  18. '*                  drawing.
  19. '*    Credits     : This class contains some functions which I(Andrea Batina)
  20. '                   found on internet.
  21. '*                  If you see your function in here please notify me(Andrea Batina)
  22. '*                  so that I can put your name on it.
  23. '*
  24. '*    Copyright   : Copyright ⌐ 2004 Revelatek. All rights reserved.
  25. '*******************************************************************************
  26.  
  27. Option Explicit
  28.  
  29. ' Base error number constant
  30. Private Const ERRBASE = 5000
  31.  
  32. ' --Private/Public Type Definitions
  33. Private Type POINTAPI
  34.     x                   As Long
  35.     y                   As Long
  36. End Type
  37.  
  38. ' --For gradient subs
  39. Public Enum GradientDirectionCts
  40.     [gdHorizontal] = 0
  41.     [gdVertical] = 1
  42.     [gdDownwardDiagonal] = 2
  43.     [gdUpwardDiagonal] = 3
  44. End Enum
  45.  
  46. ' --A trick to preserve casing of enums when typing in IDE
  47. #If False Then
  48. Private gdHorizontal, gdVertical, gdDownwardDiagonal, gdUpwardDiagonal
  49. #End If
  50.  
  51. Private Type DRAWTEXTPARAMS
  52.     cbSize              As Long
  53.     iTabLength          As Long
  54.     iLeftMargin         As Long
  55.     iRightMargin        As Long
  56.     uiLengthDrawn       As Long
  57. End Type
  58.  
  59. Private Type TEXTMETRIC
  60.     tmHeight            As Long
  61.     tmAscent            As Long
  62.     tmDescent           As Long
  63.     tmInternalLeading   As Long
  64.     tmExternalLeading   As Long
  65.     tmAveCharWidth      As Long
  66.     tmMaxCharWidth      As Long
  67.     tmWeight            As Long
  68.     tmOverhang          As Long
  69.     tmDigitizedAspectX  As Long
  70.     tmDigitizedAspectY  As Long
  71.     tmFirstChar         As Byte
  72.     tmLastChar          As Byte
  73.     tmDefaultChar       As Byte
  74.     tmBreakChar         As Byte
  75.     tmItalic            As Byte
  76.     tmUnderlined        As Byte
  77.     tmStruckOut         As Byte
  78.     tmPitchAndFamily    As Byte
  79.     tmCharSet           As Byte
  80. End Type
  81.  
  82. Private Type LOGFONT
  83.     lfHeight            As Long
  84.     lfWidth             As Long
  85.     lfEscapement        As Long
  86.     lfOrientation       As Long
  87.     lfWeight            As Long
  88.     lfItalic            As Byte
  89.     lfUnderline         As Byte
  90.     lfStrikeOut         As Byte
  91.     lfCharSet           As Byte
  92.     lfOutPrecision      As Byte
  93.     lfClipPrecision     As Byte
  94.     lfQuality           As Byte
  95.     lfPitchAndFamily    As Byte
  96.     lfFaceName(1 To 32) As Byte
  97. End Type
  98.  
  99. Private Type SIZEAPI
  100.     cX                  As Long
  101.     cY                  As Long
  102. End Type
  103. Private Type PointSng   ' Internal Point structure
  104.     x                   As Single   ' Uses Singles for more precision.
  105.     y                   As Single
  106. End Type
  107.  
  108. Private Type RGBType
  109.     r                   As Byte
  110.     g                   As Byte
  111.     B                   As Byte
  112.     A                   As Byte
  113. End Type
  114.  
  115. Private Type OSVERSIONINFO
  116.     dwOSVersionInfoSize As Long
  117.     dwMajorVersion As Long
  118.     dwMinorVersion As Long
  119.     dwBuildNumber As Long
  120.     dwPlatformID As Long
  121.     szCSDVersion As String * 128
  122. End Type
  123.  
  124. '  for gradient painting and bitmap tiling
  125. Private Type BITMAPINFOHEADER
  126.    biSize               As Long
  127.    biWidth              As Long
  128.    biHeight             As Long
  129.    biPlanes             As Integer
  130.    biBitCount           As Integer
  131.    biCompression        As Long
  132.    biSizeImage          As Long
  133.    biXPelsPerMeter      As Long
  134.    biYPelsPerMeter      As Long
  135.    biClrUsed            As Long
  136.    biClrImportant       As Long
  137. End Type
  138.  
  139. Private Const DIB_RGB_COLORS As Long = 0
  140.  
  141. Private Type PictDesc
  142.     Size                As Long
  143.     Type                As Long
  144.     hBmpOrIcon          As Long
  145.     hPal                As Long
  146. End Type
  147.  
  148. ' --Private/Public Enum Definitions
  149. Public Enum EMemDCDrawText
  150.     DT_LEFT = &H0               ' Aligns text to the left.
  151.     DT_TOP = &H0                ' Justifies the text to the top of the rectangle.
  152.     DT_CENTER = &H1             ' Centers text horizontally in the rectangle.
  153.     DT_RIGHT = &H2              ' Aligns text to the right.
  154.     DT_VCENTER = &H4            ' Centers text vertically. This value is used only with the DT_SINGLELINE value.
  155.     DT_BOTTOM = &H8             ' Justifies the text to the bottom of the rectangle. This value is used only with the DT_SINGLELINE value.
  156.     DT_WORDBREAK = &H10         ' Breaks words. Lines are automatically broken between words if a word would extend past the edge of the rectangle specified by the lpRect parameter. A carriage return-line feed sequence also breaks the line.<br>If this is not specified, output is on one line.
  157.     DT_SINGLELINE = &H20        ' Displays text on a single line only. Carriage returns and line feeds do not break the line.
  158.     DT_EXPANDTABS = &H40        ' Expands tab characters. The default number of characters per tab is eight. The DT_WORD_ELLIPSIS, DT_PATH_ELLIPSIS, and DT_END_ELLIPSIS values cannot be used with the DT_EXPANDTABS value.
  159.     DT_TABSTOP = &H80           ' Sets tab stops. Bits 15û8 (high-order byte of the low-order word) of the uFormat parameter specify the number of characters for each tab. The default number of characters per tab is eight. The DT_CALCRECT, DT_EXTERNALLEADING, DT_INTERNAL, DT_NOCLIP, and DT_NOPREFIX values cannot be used with the DT_TABSTOP value.
  160.     DT_NOCLIP = &H100           ' Draws without clipping. DrawText is somewhat faster when DT_NOCLIP is used.
  161.     DT_EXTERNALLEADING = &H200  ' Includes the font external leading in line height. Normally, external leading is not included in the height of a line of text.
  162.     DT_CALCRECT = &H400         ' Determines the width and height of the rectangle. If there are multiple lines of text, DrawText uses the width of the rectangle pointed to by the lpRect parameter and extends the base of the rectangle to bound the last line of text. If the largest word is wider than the rectangle, the width is expanded. If the text is less than the width of the rectangle, the width is reduced. If there is only one line of text, DrawText modifies the right side of the rectangle so that it bounds the last character in the line. In either case, DrawText returns the height of the formatted text but does not draw the text.
  163.     DT_NOPREFIX = &H800         ' Turns off processing of prefix characters. Normally, DrawText interprets the mnemonic-prefix character & as a directive to underscore the character that follows, and the mnemonic-prefix characters && as a directive to print a single &. By specifying DT_NOPREFIX, this processing is turned off
  164.     DT_INTERNAL = &H1000        ' Uses the system font to calculate text metrics.
  165.     DT_EDITCONTROL = &H2000     ' Duplicates the text-displaying characteristics of a multiline edit control. Specifically, the average character width is calculated in the same manner as for an edit control, and the function does not display a partially visible last line.
  166.     DT_PATH_ELLIPSIS = &H4000   ' For displayed text, replaces characters in the middle of the string with ellipses so that the result fits in the specified rectangle. If the string contains backslash (\) characters, DT_PATH_ELLIPSIS preserves as much as possible of the text after the last backslash.<br>The string is not modified unless the DT_MODIFYSTRING flag is specified.<br>Compare with DT_END_ELLIPSIS and DT_WORD_ELLIPSIS.
  167.     DT_END_ELLIPSIS = &H8000    ' For displayed text, if the end of a string does not fit in the rectangle, it is truncated and ellipses are added. If a word that is not at the end of the string goes beyond the limits of the rectangle, it is truncated without ellipses.<br>The string is not modified unless the DT_MODIFYSTRING flag is specified.<br>Compare with DT_PATH_ELLIPSIS and DT_WORD_ELLIPSIS.
  168.     DT_MODIFYSTRING = &H10000   ' Modifies the specified string to match the displayed text. This value has no effect unless DT_END_ELLIPSIS or DT_PATH_ELLIPSIS is specified.
  169.     DT_RTLREADING = &H20000     ' Layout in right-to-left reading order for bi-directional text when the font selected into the hdc is a Hebrew or Arabic font. The default reading order for all text is left-to-right.
  170.     DT_WORD_ELLIPSIS = &H40000  ' Truncates any word that does not fit in the rectangle and adds ellipses. Compare with DT_END_ELLIPSIS and DT_PATH_ELLIPSIS.
  171. End Enum
  172.  
  173. #If False Then
  174. Private DT_LEFT, DT_TOP, DT_CENTER, DT_RIGHT, DT_VCENTER, DT_BOTTOM, DT_WORDBREAK, DT_SINGLELINE, DT_EXPANDTABS, DT_TABSTOP, DT_NOCLIP, _
  175.         DT_EXTERNALLEADING, DT_CALCRECT, DT_NOPREFIX, DT_INTERNAL, DT_EDITCONTROL, DT_PATH_ELLIPSIS, DT_END_ELLIPSIS, DT_MODIFYSTRING, _
  176.         DT_RTLREADING, DT_WORD_ELLIPSIS  ':) Line inserted by Formatter
  177. #End If
  178.  
  179.  
  180. ' --Private/Public Win32 API Declarations
  181. Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (Destination As Any, Source As Any, ByVal Length As Long)
  182. Private Declare Function CreateDCAsNull Lib "gdi32" Alias "CreateDCA" (ByVal lpDriverName As String, lpDeviceName As Any, lpOutput As Any, lpInitData As Any) As Long
  183. Private Declare Function CreateCompatibleDC Lib "gdi32" (ByVal hDc As Long) As Long
  184. Private Declare Function CreateCompatibleBitmap Lib "gdi32" (ByVal hDc As Long, ByVal nWidth As Long, ByVal nHeight As Long) As Long
  185. Private Declare Function DeleteDC Lib "gdi32" (ByVal hDc As Long) As Long
  186. Private Declare Function ReleaseDC Lib "user32" (ByVal hWnd As Long, ByVal hDc As Long) As Long
  187. Private Declare Function SelectObject Lib "gdi32" (ByVal hDc As Long, ByVal hObject As Long) As Long
  188. Private Declare Function DeleteObject Lib "gdi32" (ByVal hObject As Long) As Long
  189. Private Declare Function SetBkMode Lib "gdi32" (ByVal hDc As Long, ByVal nBkMode As Long) As Long
  190. Private Declare Function APIFillRect Lib "user32" Alias "FillRect" (ByVal hDc As Long, lpRect As RECT, ByVal hBrush As Long) As Long
  191. Private Declare Function APIBitBlt Lib "gdi32" Alias "BitBlt" (ByVal hdcDest As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hdcSrc As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal dwRop As Long) As Long
  192. Private Declare Function OleTranslateColor Lib "oleaut32.dll" (ByVal lOleColor As Long, ByVal lHPalette As Long, lColorRef As Long) As Long
  193. Private Declare Function CreateSolidBrush Lib "gdi32" (ByVal crColor As Long) As Long
  194. Private Declare Function CreatePen Lib "gdi32" (ByVal nPenStyle As Long, ByVal nWidth As Long, ByVal crColor As Long) As Long
  195. Private Declare Function MoveToEx Lib "gdi32" (ByVal hDc As Long, ByVal x As Long, ByVal y As Long, lpPoint As POINTAPI) As Long
  196. Private Declare Function LineTo Lib "gdi32" (ByVal hDc As Long, ByVal x As Long, ByVal y As Long) As Long
  197. Private Declare Function DrawState Lib "user32" Alias "DrawStateA" (ByVal hDc As Long, ByVal hBrush As Long, ByVal lpDrawStateProc As Long, ByVal lParam As Long, ByVal wParam As Long, ByVal n1 As Long, ByVal n2 As Long, ByVal n3 As Long, ByVal n4 As Long, ByVal un As Long) As Long
  198. Private Declare Function ApiDrawTextEx Lib "user32" Alias "DrawTextExA" (ByVal hDc As Long, ByVal lpsz As String, ByVal n As Long, lpRect As RECT, ByVal un As Long, lpDrawTextParams As DRAWTEXTPARAMS) As Long
  199. Private Declare Function GetTextMetrics Lib "gdi32" Alias "GetTextMetricsA" (ByVal hDc As Long, lpMetrics As TEXTMETRIC) As Long
  200. Private Declare Function GetTextFace Lib "gdi32" Alias "GetTextFaceA" (ByVal hDc As Long, ByVal nCount As Long, ByVal lpFacename As String) As Long
  201. Private Declare Function GetDeviceCaps Lib "gdi32" (ByVal hDc As Long, ByVal nIndex As Long) As Long
  202. Private Declare Function CreateFontIndirect Lib "gdi32" Alias "CreateFontIndirectA" (lpLogFont As LOGFONT) As Long
  203. Private Declare Function GetTextColor Lib "gdi32" (ByVal hDc As Long) As Long
  204. Private Declare Function SetTextColor Lib "gdi32" (ByVal hDc As Long, ByVal crColor As Long) As Long
  205. Private Declare Function GetTextExtentPointA Lib "gdi32" (ByVal hDc As Long, ByVal lpszString As String, ByVal cbString As Long, lpSize As SIZEAPI) As Long
  206. Private Declare Function GetTextExtentPointW Lib "gdi32" (ByVal hDc As Long, ByVal lpszString As Long, ByVal cbString As Long, lpSize As SIZEAPI) As Long
  207. Private Declare Function APIGetPixel Lib "gdi32" Alias "GetPixel" (ByVal hDc As Long, ByVal x As Long, ByVal y As Long) As Long
  208. Private Declare Function APISetPixel Lib "gdi32" Alias "SetPixel" (ByVal hDc As Long, ByVal x As Long, ByVal y As Long, ByVal crColor As Long) As Long
  209. Private Declare Function DrawTextW Lib "user32" (ByVal hDc As Long, ByVal lpStr As Long, ByVal nCount As Long, lpRect As RECT, ByVal wFormat As Long) As Long
  210. Private Declare Function GetDC Lib "user32.dll" (ByVal hWnd As Long) As Long
  211. Private Declare Function GetVersionEx Lib "kernel32" Alias "GetVersionExA" (lpVersionInformation As OSVERSIONINFO) As Long
  212. Private Declare Function OleCreatePictureIndirect Lib "olepro32.dll" (lpPictDesc As PictDesc, riid As Any, ByVal fPictureOwnsHandle As Long, ipic As IPicture) As Long
  213. Private Declare Function CreateHalftonePalette Lib "gdi32" (ByVal hDc As Long) As Long
  214. Private Declare Function SelectPalette Lib "gdi32" (ByVal hDc As Long, ByVal hPalette As Long, ByVal bForceBackground As Long) As Long
  215. Private Declare Function RealizePalette Lib "gdi32" (ByVal hDc As Long) As Long
  216. Private Declare Function CreateBitmap Lib "gdi32" (ByVal nWidth As Long, ByVal nHeight As Long, ByVal nPlanes As Long, ByVal nBitCount As Long, lpBits As Any) As Long
  217. Private Declare Function GetBkColor Lib "gdi32" (ByVal hDc As Long) As Long
  218. Private Declare Function SetBkColor Lib "gdi32" (ByVal hDc As Long, ByVal crColor As Long) As Long
  219. Private Declare Function StretchDIBits Lib "gdi32" (ByVal hDc As Long, ByVal x As Long, ByVal y As Long, ByVal dx As Long, ByVal dy As Long, ByVal SrcX As Long, ByVal SrcY As Long, ByVal wSrcWidth As Long, ByVal wSrcHeight As Long, lpBits As Any, lpBitsInfo As Any, ByVal wUsage As Long, ByVal dwRop As Long) As Long
  220.  
  221.  
  222. ' --Private/Public Constant Declarations
  223. ' Pen Style Messages
  224. Private Const PS_SOLID = 0
  225. Private Const PS_DOT = 2
  226.  
  227. ' Draw State Messages
  228. Private Const DST_BITMAP = &H4
  229. Private Const DST_COMPLEX = &H0
  230. Private Const DST_ICON = &H3
  231. Private Const DSS_NORMAL = &H0
  232. Private Const DSS_MONO = &H80
  233.  
  234. ' Misc Messages
  235. Private Const LOGPIXELSY = 90
  236. Private Const FW_NORMAL = 400
  237. Private Const PI    As Double = 3.14159265358979
  238. Private Const RADS  As Double = PI / 180
  239.  
  240.  
  241. ' --Private/Public Variable Declarations
  242. Private m_lhDC              As Long     ' Memory dc handle
  243. Private m_lWidth            As Long     ' Memory dc width
  244. Private m_lHeight           As Long     ' Memory dc height
  245. Private m_hBmp              As Long     ' Memory dc new compatible bitmap
  246. Private m_hBmpOld           As Long     ' Memory dc old compatible bitmap
  247. Private m_lOrginalFont      As Long     ' Memory dc original font
  248. Private m_lMemoryFont       As Long     ' Memory dc new font
  249.  
  250. '********************************************************************
  251. '* Name: AlphaBlend
  252. '* Description: Returns alpha blend of two specified colors.
  253. '********************************************************************
  254.  
  255. Public Function AlphaBlend(ByVal lColorOne As Long, ByVal lColorTwo As Long, ByVal lAlpha As Long) As OLE_COLOR
  256.  
  257. Dim tClrFore         As RGBType
  258. Dim tClrBack         As RGBType
  259.  
  260. ' Translate both colors
  261.  
  262.     lColorOne = TranslateColor(lColorOne)
  263.     lColorTwo = TranslateColor(lColorTwo)
  264.     ' Split second color into RGB elements
  265.     With tClrBack
  266.         .r = GetRGB(lColorTwo, 1)
  267.         .g = GetRGB(lColorTwo, 2)
  268.         .B = GetRGB(lColorTwo, 3)
  269.     End With
  270.     With tClrFore
  271.         ' Split the first color also
  272.         .r = GetRGB(lColorOne, 1)
  273.         .g = GetRGB(lColorOne, 2)
  274.         .B = GetRGB(lColorOne, 3)
  275.         ' Alpha blend each color item
  276.         .r = (.r * lAlpha + tClrBack.r * (255 - lAlpha)) / 255
  277.         .g = (.g * lAlpha + tClrBack.g * (255 - lAlpha)) / 255
  278.         .B = (.B * lAlpha + tClrBack.B * (255 - lAlpha)) / 255
  279.     End With
  280.     ' Return blended color
  281.     AlphaBlend = RGB(tClrFore.r, tClrFore.g, tClrFore.B)
  282.  
  283. End Function
  284.  
  285. '********************************************************************
  286. '* Name: BitBlt
  287. '* Description: Transfers image from memory dc to hdcDest dc.
  288. '********************************************************************
  289.  
  290. Public Sub BitBlt(ByVal hdcDest As Long, _
  291.                   Optional ByVal xDest As Long, _
  292.                   Optional ByVal yDest As Long, _
  293.                   Optional ByVal lWidth As Long, _
  294.                   Optional ByVal lHeight As Long, _
  295.                   Optional ByVal xSrc As Long, _
  296.                   Optional ByVal ySrc As Long, _
  297.                   Optional ByVal dwRop As RasterOpConstants = vbSrcCopy, _
  298.                   Optional ByVal lhdcSrc As Long = 0)
  299.  
  300.     On Error GoTo PROC_ERR_BitBlt
  301.  
  302.     If Not IsCreated Then
  303.         Exit Sub
  304.     End If
  305.  
  306.     ' Setup properties
  307.     If lWidth = 0 Then
  308.         lWidth = m_lWidth
  309.     End If
  310.     
  311.     If lHeight = 0 Then
  312.         lHeight = m_lHeight
  313.     End If
  314.     ' BitBlt
  315.     If lhdcSrc <> 0 Then
  316.         APIBitBlt hdcDest, xDest, yDest, lWidth, lHeight, lhdcSrc, xSrc, ySrc, dwRop
  317.     Else
  318.         APIBitBlt hdcDest, xDest, yDest, lWidth, lHeight, m_lhDC, xSrc, ySrc, dwRop
  319.     End If
  320.  
  321. PROC_EXIT:
  322.  
  323. Exit Sub
  324.  
  325. PROC_ERR_BitBlt:
  326.     Err.Raise ERRBASE, App.EXEName & ".CMemoryDC.BitBlt", "CMemoryDC component failure!" & vbCrLf & vbCrLf & Err.Number & ": " & Err.Description & vbCrLf & "On line: " & Erl
  327.     Resume PROC_EXIT
  328.  
  329. End Sub
  330.  
  331. '********************************************************************
  332. '* Name: Class_Terminate
  333. '* Description: Class object termination.
  334. '********************************************************************
  335.  
  336. Private Sub Class_Terminate()
  337.  
  338.     On Error Resume Next
  339.     pDestroyMemDC
  340.  
  341. End Sub
  342.  
  343. '********************************************************************
  344. '* Name: Cls
  345. '* Description: Clear memory dc.
  346. '********************************************************************
  347.  
  348. Public Sub Cls(Optional ByVal lColor As Long = -1)
  349.  
  350.     FillRect 0, 0, Width, Height, lColor
  351.  
  352. End Sub
  353.  
  354. '********************************************************************
  355. '* Name: Draw3DRect
  356. '* Description: Draw 3D rectangle.
  357. '********************************************************************
  358.  
  359. Public Sub Draw3DRect( _
  360.                       ByVal lLeft As Long, _
  361.                       ByVal lTop As Long, _
  362.                       ByVal lRight As Long, _
  363.                       ByVal lBottom As Long, _
  364.                       ByVal oTopLeftColor As OLE_COLOR, _
  365.                       ByVal oBottomRightColor As OLE_COLOR)
  366.  
  367.     On Error GoTo PROC_ERR_Draw3DRect
  368.  
  369.     If Not IsCreated() Then
  370.         Exit Sub
  371.     End If
  372.  
  373.     Dim hPen As Long
  374.     Dim hPenOld As Long
  375.     Dim tP As POINTAPI
  376.     Dim rcItem As RECT
  377.  
  378.     ' Setup rectangle dimensions
  379.     With rcItem
  380.         .Left = lLeft
  381.         .Top = lTop
  382.         .Right = lRight
  383.         .Bottom = lBottom
  384.     End With
  385.  
  386.     ' Create pen with specified color
  387.     hPen = CreatePen(PS_SOLID, 1, TranslateColor(oTopLeftColor))
  388.     ' Save old pen
  389.     hPenOld = SelectObject(m_lhDC, hPen)
  390.     ' Draw top-left of rectangle
  391.     MoveToEx m_lhDC, rcItem.Left, rcItem.Bottom - 1, tP
  392.     LineTo m_lhDC, rcItem.Left, rcItem.Top
  393.     LineTo m_lhDC, rcItem.Right - 1, rcItem.Top
  394.     ' Restore old pen
  395.     SelectObject m_lhDC, hPenOld
  396.     ' Delete pen
  397.     DeleteObject hPen
  398.     ' If there is right border
  399.     If rcItem.Left <> rcItem.Right Then
  400.         ' Create pen
  401.         hPen = CreatePen(PS_SOLID, 1, TranslateColor(oBottomRightColor))
  402.         ' Save old pen
  403.         hPenOld = SelectObject(m_lhDC, hPen)
  404.         ' Draw bottom-right of rectangle
  405.         LineTo m_lhDC, rcItem.Right - 1, rcItem.Bottom - 1
  406.         LineTo m_lhDC, rcItem.Left - 1, rcItem.Bottom - 1
  407.         ' Restore old pen
  408.         SelectObject m_lhDC, hPenOld
  409.         ' Delete pen
  410.         DeleteObject hPen
  411.     End If
  412.  
  413. PROC_EXIT:
  414.  
  415. Exit Sub
  416.  
  417. PROC_ERR_Draw3DRect:
  418.     Err.Raise ERRBASE, App.EXEName & ".CMemoryDC.Draw3DRect", "CMemoryDC component failure!" & vbCrLf & vbCrLf & Err.Number & ": " & Err.Description & vbCrLf & "On line: " & Erl
  419.     Resume PROC_EXIT
  420.  
  421. End Sub
  422.  
  423. Public Sub DrawLine(ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long, ByVal Color As Long, Optional lHdc As Long = 0)
  424.  
  425. '****************************************************************************
  426. '* draw lines
  427. '****************************************************************************
  428.  
  429. Dim pt               As POINTAPI
  430. Dim hPen             As Long
  431. Dim hPenOld          As Long
  432.  
  433.     If Not IsCreated Then
  434.         Exit Sub
  435.     End If
  436.     
  437.     If lHdc <> 0 Then
  438.         hPen = CreatePen(0, 1, TranslateColor(Color))
  439.         hPenOld = SelectObject(lHdc, hPen)
  440.         MoveToEx lHdc, X1, Y1, pt
  441.         LineTo lHdc, X2, Y2
  442.         SelectObject lHdc, hPenOld
  443.         DeleteObject hPen
  444.     End If
  445.     
  446.     hPen = CreatePen(0, 1, TranslateColor(Color))
  447.     hPenOld = SelectObject(m_lhDC, hPen)
  448.     MoveToEx m_lhDC, X1, Y1, pt
  449.     LineTo m_lhDC, X2, Y2
  450.     SelectObject m_lhDC, hPenOld
  451.     DeleteObject hPen
  452.  
  453. End Sub
  454.  
  455. Public Sub DrawGradient(ByVal x As Long, ByVal y As Long, ByVal Width As Long, ByVal Height As Long, ByVal Color1 As Long, ByVal Color2 As Long, ByVal GradientDirection As GradientDirectionCts)
  456.  
  457. '****************************************************************************
  458. '* Draws very fast Gradient in four direction.                              *
  459. '* Author: Carles P.V (Gradient Master)                                     *
  460. '****************************************************************************
  461.  
  462. Dim uBIH             As BITMAPINFOHEADER
  463. Dim lBits()          As Long
  464. Dim lGrad()          As Long
  465.  
  466. Dim r1               As Long
  467. Dim g1               As Long
  468. Dim b1               As Long
  469. Dim r2               As Long
  470. Dim g2               As Long
  471. Dim b2               As Long
  472. Dim dR               As Long
  473. Dim dG               As Long
  474. Dim dB               As Long
  475.  
  476. Dim Scan             As Long
  477. Dim i                As Long
  478. Dim iEnd             As Long
  479. Dim iOffset          As Long
  480. Dim J                As Long
  481. Dim jEnd             As Long
  482. Dim iGrad            As Long
  483.  
  484. Dim lTmpColor        As Long
  485.  
  486.     '-- A minor check
  487.  
  488.    If (Width < 1 Or Height < 1) Then
  489.         Exit Sub
  490.     End If
  491.     
  492.     ' --I have swapped colors
  493.     ' --as Andrea was using different DrawGradient routine
  494.     ' --and was interchanging the angle :-)
  495.     '****************************
  496.     lTmpColor = Color2          '
  497.     Color2 = Color1             '
  498.     Color1 = lTmpColor          '
  499.     '****************************
  500.     
  501.     '-- Decompose colors
  502.     Color1 = Color1 And &HFFFFFF
  503.     r1 = Color1 Mod &H100&
  504.     Color1 = Color1 \ &H100&
  505.     g1 = Color1 Mod &H100&
  506.     Color1 = Color1 \ &H100&
  507.     b1 = Color1 Mod &H100&
  508.     Color2 = Color2 And &HFFFFFF
  509.     r2 = Color2 Mod &H100&
  510.     Color2 = Color2 \ &H100&
  511.     g2 = Color2 Mod &H100&
  512.     Color2 = Color2 \ &H100&
  513.     b2 = Color2 Mod &H100&
  514.  
  515.     '-- Get color distances
  516.     dR = r2 - r1
  517.     dG = g2 - g1
  518.     dB = b2 - b1
  519.  
  520.     '-- Size gradient-colors array
  521.     Select Case GradientDirection
  522.     Case [gdHorizontal]
  523.         ReDim lGrad(0 To Width - 1)
  524.     Case [gdVertical]
  525.         ReDim lGrad(0 To Height - 1)
  526.     Case Else
  527.         ReDim lGrad(0 To Width + Height - 2)
  528.     End Select
  529.  
  530.     '-- Calculate gradient-colors
  531.     iEnd = UBound(lGrad())
  532.     If (iEnd = 0) Then
  533.         '-- Special case (1-pixel wide gradient)
  534.         lGrad(0) = (b1 \ 2 + b2 \ 2) + 256 * (g1 \ 2 + g2 \ 2) + 65536 * (r1 \ 2 + r2 \ 2)
  535.     Else
  536.         For i = 0 To iEnd
  537.             lGrad(i) = b1 + (dB * i) \ iEnd + 256 * (g1 + (dG * i) \ iEnd) + 65536 * (r1 + (dR * i) \ iEnd)
  538.         Next i
  539.     End If
  540.  
  541.     '-- Size DIB array
  542.     ReDim lBits(Width * Height - 1) As Long
  543.     iEnd = Width - 1
  544.     jEnd = Height - 1
  545.     Scan = Width
  546.  
  547.     '-- Render gradient DIB
  548.     Select Case GradientDirection
  549.  
  550.     Case [gdHorizontal]
  551.  
  552.         For J = 0 To jEnd
  553.             For i = iOffset To iEnd + iOffset
  554.                 lBits(i) = lGrad(i - iOffset)
  555.             Next i
  556.             iOffset = iOffset + Scan
  557.         Next J
  558.  
  559.     Case [gdVertical]
  560.  
  561.         For J = jEnd To 0 Step -1
  562.             For i = iOffset To iEnd + iOffset
  563.                 lBits(i) = lGrad(J)
  564.             Next i
  565.             iOffset = iOffset + Scan
  566.         Next J
  567.  
  568.     Case [gdDownwardDiagonal]
  569.  
  570.         iOffset = jEnd * Scan
  571.         For J = 1 To jEnd + 1
  572.             For i = iOffset To iEnd + iOffset
  573.                 lBits(i) = lGrad(iGrad)
  574.                 iGrad = iGrad + 1
  575.             Next i
  576.             iOffset = iOffset - Scan
  577.             iGrad = J
  578.         Next J
  579.  
  580.     Case [gdUpwardDiagonal]
  581.  
  582.         iOffset = 0
  583.         For J = 1 To jEnd + 1
  584.             For i = iOffset To iEnd + iOffset
  585.                 lBits(i) = lGrad(iGrad)
  586.                 iGrad = iGrad + 1
  587.             Next i
  588.             iOffset = iOffset + Scan
  589.             iGrad = J
  590.         Next J
  591.     End Select
  592.  
  593.     '-- Define DIB header
  594.     With uBIH
  595.         .biSize = 40
  596.         .biPlanes = 1
  597.         .biBitCount = 32
  598.         .biWidth = Width
  599.         .biHeight = Height
  600.     End With
  601.  
  602.     '-- Paint it!
  603.     StretchDIBits m_lhDC, x, y, Width, Height, 0, 0, Width, Height, lBits(0), uBIH, DIB_RGB_COLORS, vbSrcCopy
  604.  
  605. End Sub
  606.  
  607. '********************************************************************
  608. '* Name: DrawPicture
  609. '* Description: Draw specified picture on memory dc.
  610. '********************************************************************
  611.  
  612. Public Sub DrawPicture(ByRef m_PictureF As StdPicture, _
  613.                        ByVal x As Long, _
  614.                        ByVal y As Long, _
  615.                        Optional lW As Long = 16, _
  616.                        Optional lH As Long = 16, _
  617.                        Optional bShadow As Boolean = False, _
  618.                        Optional lShadowColor As Long = -1, _
  619.                        Optional lMaskColor As Long = -1)
  620.  
  621. Dim lFlags As Long
  622. Dim hBrush As Long
  623.  
  624.     'On Error GoTo PROC_ERR_DrawPicture
  625.  
  626.     If Not IsCreated() Then
  627.         Exit Sub
  628.     End If
  629.  
  630.     ' Get image type
  631.     Select Case m_PictureF.Type
  632.     Case vbPicTypeBitmap
  633.         lFlags = DST_BITMAP
  634.  
  635.         Dim hdcPaint As Long, hbmOrig As Long
  636.         hdcPaint = CreateCompatibleDC(m_lhDC)
  637.         hbmOrig = SelectObject(hdcPaint, m_PictureF.handle)
  638.         If lMaskColor = -1 Then
  639.             APIBitBlt m_lhDC, x, y, lW, lH, hdcPaint, 0, 0, vbSrcCopy
  640.         Else
  641.             pvTransBlt m_lhDC, x, y, lW, lH, hdcPaint, 0, 0, lMaskColor
  642.         End If
  643.         SelectObject hdcPaint, hbmOrig
  644.         DeleteDC hdcPaint
  645.         Exit Sub
  646.  
  647.     Case vbPicTypeIcon
  648.         lFlags = DST_ICON
  649.     Case Else
  650.         lFlags = DST_COMPLEX
  651.     End Select
  652.     ' If shadow is set then create shadow brush
  653.     If bShadow Then
  654.         If lShadowColor <> -1 Then
  655.             hBrush = CreateSolidBrush(lShadowColor)
  656.         Else
  657.             hBrush = CreateSolidBrush(TranslateColor(vbButtonShadow))
  658.         End If
  659.     End If
  660.     ' Draw icon
  661.     DrawState m_lhDC, IIf(bShadow, hBrush, 0), 0, m_PictureF.handle, 0, x, y, lW, lH, lFlags Or IIf(bShadow, DSS_MONO, DSS_NORMAL)
  662.  
  663.     ' Delete shadow brush object
  664.     If bShadow Then
  665.         DeleteObject hBrush
  666.     End If
  667.  
  668. PROC_EXIT:
  669.  
  670. Exit Sub
  671.  
  672. PROC_ERR_DrawPicture:
  673. '    Err.Raise ERRBASE, App.EXEName & ".CMemoryDC.DrawPicture", "CMemoryDC component failure!" & vbCrLf & vbCrLf & Err.Number & ": " & Err.Description & vbCrLf & "On line: " & Erl
  674.     Resume PROC_EXIT
  675.  
  676. End Sub
  677.  
  678. '********************************************************************
  679. '* Name: DrawText
  680. '* Description: Draw text on memory device contex.
  681. '********************************************************************
  682.  
  683. Public Sub DrawText( _
  684.                     ByVal sText As String, _
  685.                     ByRef lLeft As Long, _
  686.                     ByRef lTop As Long, _
  687.                     ByRef lRight As Long, _
  688.                     ByRef lBottom As Long, _
  689.                     Optional ByVal lFlags As EMemDCDrawText)
  690.  
  691.     On Error GoTo PROC_ERR_DrawText
  692.  
  693.     If Not IsCreated() Then
  694.         Exit Sub
  695.     End If
  696.  
  697. Dim rc As RECT
  698. Dim wTextParams As DRAWTEXTPARAMS
  699.  
  700.     ' Setup text box dimensions
  701.     With rc
  702.         .Left = lLeft
  703.         .Top = lTop
  704.         .Right = lRight
  705.         .Bottom = lBottom
  706.     End With
  707.     wTextParams.cbSize = Len(wTextParams)
  708.  
  709.     ' If windows 9x
  710.     If Not pIsWinNT Then
  711.         ApiDrawTextEx m_lhDC, sText, Len(sText), rc, lFlags, wTextParams
  712.     Else
  713.         DrawTextW m_lhDC, StrPtr(sText), -1, rc, lFlags Or DT_RTLREADING
  714.     End If
  715.  
  716.     ' Return text dimensions
  717.     With rc
  718.         lLeft = .Left
  719.         lTop = .Top
  720.         lRight = .Right
  721.         lBottom = .Bottom
  722.     End With
  723.  
  724. PROC_EXIT:
  725.  
  726. Exit Sub
  727.  
  728. PROC_ERR_DrawText:
  729.     Err.Raise ERRBASE, App.EXEName & ".CMemoryDC.DrawText", "CMemoryDC component failure!" & vbCrLf & vbCrLf & Err.Number & ": " & Err.Description & vbCrLf & "On line: " & Erl
  730.     Resume PROC_EXIT
  731.  
  732. End Sub
  733.  
  734. '********************************************************************
  735. '* Name: FillRect
  736. '* Description: Fill rect with specified color.
  737. '********************************************************************
  738.  
  739. Public Sub FillRect( _
  740.                     Optional ByVal lLeft As Long, _
  741.                     Optional ByVal lTop As Long, _
  742.                     Optional ByVal lRight As Long = -1, _
  743.                     Optional ByVal lBottom As Long = -1, _
  744.                     Optional ByVal lColor As Long = -1, _
  745.                     Optional ByVal lHdc As Long)
  746.  
  747. Dim rc As RECT
  748. Dim hbrFill As Long
  749. Dim hOldBrush As Long
  750.  
  751.     On Error GoTo PROC_ERR_FillRect
  752.  
  753.     If Not IsCreated Then
  754.         Exit Sub
  755.     End If
  756.  
  757.     ' Create solid brush with specified color
  758.     If lColor <> -1 Then
  759.         hbrFill = CreateSolidBrush(TranslateColor(lColor))
  760.         If lHdc <> 0 Then
  761.             hOldBrush = SelectObject(lHdc, hbrFill)
  762.         Else
  763.             hOldBrush = SelectObject(m_lhDC, hbrFill)
  764.         End If
  765.     End If
  766.     
  767.     ' Setup rectangle dimensions
  768.     With rc
  769.         .Left = lLeft
  770.         .Top = lTop
  771.         .Right = IIf(lRight < lLeft, Width, lRight)
  772.         .Bottom = IIf(lBottom < lTop, Height, lBottom)
  773.     End With
  774.     
  775.     ' Fill rect
  776.     If lHdc <> 0 Then
  777.         APIFillRect lHdc, rc, hbrFill
  778.     Else
  779.         APIFillRect m_lhDC, rc, hbrFill
  780.     End If
  781.     
  782.     ' Delete brush object
  783.     If lColor <> -1 Then
  784.         If lHdc <> 0 Then
  785.             SelectObject lHdc, hOldBrush
  786.         Else
  787.             SelectObject m_lhDC, hOldBrush
  788.         End If
  789.         DeleteObject hbrFill
  790.     End If
  791.  
  792. PROC_EXIT:
  793.  
  794. Exit Sub
  795.  
  796. PROC_ERR_FillRect:
  797.     Err.Raise ERRBASE, App.EXEName & ".CMemoryDC.FillRect", "CMemoryDC component failure!" & vbCrLf & vbCrLf & Err.Number & ": " & Err.Description & vbCrLf & "On line: " & Erl
  798.     Resume PROC_EXIT
  799.  
  800. End Sub
  801.  
  802. Public Property Set Font(ByVal oValue As StdFont)
  803.  
  804.     On Error GoTo PROC_ERR_Font
  805.  
  806.     If Not IsCreated() Then
  807.         Exit Property
  808.     End If
  809.  
  810.     Dim tFont           As LOGFONT
  811.  
  812.     ' Fill LOGFONT type with new font properties
  813.     With tFont
  814.         CopyMemory .lfFaceName(1), ByVal oValue.Name, Len(oValue.Name) + 1
  815.         .lfCharSet = oValue.Charset
  816.         .lfItalic = (-oValue.Italic)
  817.         .lfStrikeOut = (-oValue.Strikethrough)
  818.         .lfUnderline = (-oValue.Underline)
  819.         .lfWeight = oValue.Weight
  820.         .lfHeight = -(oValue.Size * GetDeviceCaps(m_lhDC, LOGPIXELSY) \ 72)
  821.     End With
  822.     
  823.     ' Select new font into memory dc and delete the previous one
  824.     If m_lMemoryFont <> 0 Then
  825.         SelectObject m_lhDC, m_lOrginalFont
  826.         DeleteObject m_lMemoryFont
  827.     End If
  828.     
  829.     m_lMemoryFont = CreateFontIndirect(tFont)
  830.     m_lOrginalFont = SelectObject(m_lhDC, m_lMemoryFont)
  831.  
  832. PROC_EXIT:
  833.  
  834. Exit Property
  835.  
  836. PROC_ERR_Font:
  837.     Err.Raise ERRBASE, App.EXEName & ".CMemoryDC.Font", "CMemoryDC component failure!" & vbCrLf & vbCrLf & Err.Number & ": " & Err.Description & vbCrLf & "On line: " & Erl
  838.     Resume PROC_EXIT
  839.  
  840. End Property
  841.  
  842. '********************************************************************
  843. '* Name: Font
  844. '* Description: Return\sets memory dc font.
  845. '********************************************************************
  846.  
  847. Public Property Get Font() As StdFont
  848.  
  849.     On Error GoTo PROC_ERR_Font
  850.  
  851.     If Not IsCreated() Then
  852.         Exit Property
  853.     End If
  854.  
  855. Dim tTM             As TEXTMETRIC
  856. Dim sFaceName       As String * 80
  857.  
  858.     ' Get text metrics
  859.     GetTextMetrics m_lhDC, tTM
  860.     ' Return font ' Pet = (-oValue.Str     E, hOldBrushet = ont
  861.  
  862.    
  863.     
  864.    Option  hPen =
  865.        -ot*******S*****As Lonet = oVC Err. Long, ByVal **As Lonet =lsxit Pro= oVC Erm rc As RECT= m_lHefc + 1
  866.  o" (ByVal hD*******idtry .     Exit Prb Exit Propenet = oVC Err. Lo.lfWeight50at PrlhDC, x, y, t
  867.  
  868.     I* Lo.HatedC componen)bm
  869.     ryFont)
  870.  
  871. PRl
  872.     E******S*****As Lonet = oVC Err. Long, ByVal **As Lonet =lsxit        b Exism_lOrginalFont
  873.  GetTextm,ydnt
  874.  Ge=lsxit ProginalFon.l hD****yG GetTextm,tm,ydntof tht ProginalFon.hDC,B     eated() m,ydnt
  875.  Ge=lsxit ProginalFon.l hD****yG GetTextm,tm,ydntof tht ProginalFon.hDC,B     eatplaying charact   I* Lo.HatedC compobp    VC EFon.hDt)Lon.hDC,B    ct   I* Lo.e     i
  876.  o" (BylMemoryl **As LonhDChDt)Lon)
  877. m,t 
  878.    DC,B    ct  rtOIndirect(tFont)w-order S3h
  879.    fh
  880.     
  881.     ' Select newperty
  882.     End I
  883.     g = Seleco lLeGetTeAs Lonett new '*****s g =Fo l \ 2 + g2 \ 2) + 6=Fo l  GetTeAs L)t" & Erl
  884.     Resume PROC_ient
  885.  o   Dt new '*****s g =Fo l \ 2 + g2 \ 2) + 6=Fo l  GetTeAs L)t" & Erl
  886.     Resume PROC_ient
  887.  o   (Cesume PROC_ient
  888. 2+ 6=Fo l  GetROC_ient
  889.  c.hDC,B      End ISa
  890.  c.'   i
  891. DoGetROC_iOC_  lRight = .Right
  892.  GeE, App.EXEName & ".CMemoryDC.DrawPicture", "Ce E\ 2))w-ordaErr- Rtup rectangle  6=Fo l  G(lpVectangle  6=Fo l  G(lpVectangle  6=Fo l  G(l
  893.     b2 = ,C PROC_ient   b2 = ,C PPPPPPPPP = ,C,C PPPPPPPPP = ,C,C PPPPPPPPP = ,C,C PPPPPPPPP = ,C,C PPPPPPPPP = ,C,C PPPPPPPPP = ,C,C PPPPPPPPP = ,C,C PPPPPPPPP = ,C,C me & ".C    End I
  894.     g = SelecorFoen create shadow brush
  895.  P = ,C,Cs PPPPPP End I
  896. pColSCs PPPPPa    c <> 0 TPPPPPPPPc GoTo PROC_ERR_Font
  897.  
  898.     If Not IsCreatePP = ption: Draw text o   If No
  899.  
  900.     I,C PPPPPPPLong
  901. Private  nong) Asos
  902.  
  903.     If Not IsCrrivate  non Cs PPPPP             ByRef lBottom As Long, _
  904.                     Optional ByVal lFlags As EMemDCDrawptraw t-a'***Srations
  905. ' Pen Style Messages
  906. Private Const PS_SOLID = 0
  907. Private Const PS_DOT = 2
  908.  
  909. 'pyM k/1   gConst PS_uh lColorT, lpMetplaying charac      2  Optiona  If Not IsCrrial By, t
  910.  
  911.     I* L7Sng   ' Internal Point structure
  912.     x                   As Single   ' Uses Singles for more precision.
  913.     y                   As Single
  914. End Type
  915.  
  916. Private Type RGBType
  917.     r                   As Byte
  918.     g                   As Byte
  919.     B           </3nd DT_W   r        u)on DrawState Lib "usss Singles5nW   r     e Co25 Byte
  920.     g                _W   r        u)on DrawState Lib "u0e     Lib Lony'***'***5a PPPPp      As SingUses Singles for more precision.
  921.     y                   As Single
  922. End Type
  923.  
  924. Private Tyt    hBVal lFlags re pre6MSelect
  925.    u strucroginalFont     C
  926.   se, _
  927. ng
  928. Private Declare Function SetBkMode Lib "gdi32" (ByVal hDc As Long, ByVal nBkMoertynd Typed I
  929. pColm    his PPPPnd Typed  pointedu<resume PROCiPPPpong, ByVal nBkMoet)'rIped  pointedu<resume PROCiPPPpong, ByVal nBkMoet)'rIped  pointedu<resume PROCiPPPpong, ByVal nBkMoet)'rIped  pointedu<resume PROCiPPPpong, ByVal nBkMoet)'rIped  pointedu<resume PROCiPPPpong, ByVal 
  930.    i       g, ByVal 
  931.    i       g, ByVal 
  932.    i       g, ByVal 
  933.    i       g, ByVal 
  934.    i       g, ByVal      OC_ient & Erl ,Color = Colorient &Rnd If
  935.  
  936.                     Val nBkMode Lib "gdi32" (ByVal hDc As Long, ByVal nBkMoertynd Typed     Valr  i     s Long,t
  937.  
  938.    
  939.  al  IIf(l g = SerivaVala    Exime PROCiPPPpong, BtMoert_DrawTexPpong, BtMEun
  940.   Long,t
  941.  
  942. BtMEustifies the text to the bottom >al nBkMoertynd Typed     Valr  i     s Long,t
  943.  
  944.    
  945.  al  IIf(l g = SerivaVala    Exime PROCiPPPpong, BtMoert_DrawTexPpong, BtMEun
  946.   Long,t
  947.  
  948. BtMEustifies      As LongX2C bottom >al GBO98ib "(B As LongX2l Height As Long nBkMoet)'r >al GBO,e
  949.  I*******seExA" (ByP = ,C,C PPPPPPPPP = ,C,C me & ".C    End I
  950.       EECT, ByVal hBrEnd I
  951.       EECT, EEC   EECT, EEC   EECT, EEC   a>al t)'rOM, DT_Wi EEC al  IIfByVal hWidth + Hel yDest As  me & (<      As Lon     goryDC.DrawPicme & (<    <jPicm= ,C,C me &8ib "(B A As Lon     goryD  a>al t)'rOM, DbItem.Bottom - 1,  & (< r a>al  .lfWeá (< r a>al  .lfWeá (< r a>al  .lfWeá (< r a>al  .lfWeá (< r a>al  .lfWeá (< rgur a>al  .tem.Bott/t)'rIpe a>al   ,C,B^blicBSi     .sf characters per tab is eilfWeá (< r a>alfByV< r   ,C,B^blicBDraw3DRect
  952. SubB per b is Lona2 EECT, EEC   EECdth + He a>aS Lona222222222      As Lon     DT_RTB=>al G2222 Long) As Long
  953. Private Declare Function GBtMoe<      As Lon     goryDC.DDKSe FunBkMoet)'rIpeo22 Long)C.DDKSe FunBkMoet)'''''''''''''''''''''''''''''''''''''''''''n)
  954.        O'''BFFFF (< ro''''''''A)'''''unBkMoet)'''''' Long,t    EEC   El
  955.        O'''BFFelh + HenBkMoet6=Fo l  G(''''''''''=Fo l  g,t    EEC  oG    O'''BFF    End IfUdc.
  956. jAS       C  oG  +6       s  ' I rr.Number n( -(oValue.RG  +6       s  ' I rr.Number n( -(oValue.RG  +6       s  ' I rr.Number n( -(oValue.RG  +6)     O'''Boe<    s      O''   O'''Boe<    s         s      O''   O'''Boe<    s         s      O''   O'''Boe<    s         s       O''   O'FFFFFF
  957.     r1 s      '''nePPP = ,C,C PPPP With rcttr'unBkMoet)'''''' Long,t   Dternal leading in line height. Normally, leadingggggggggggg   '''nePse
  958.             hOldBrusDrLongtyle As Longt PI    A.   **
  959.  
  960. ''' , lBits)           (oValue.ongtyle   Ongtyle As Longt PIe.RG  +6)  les      Ongyle   Ongtyle As Lon1(abR''Boele As Lon1(abR''Boele As Lon1(abR''Boele As Lon1(abR''Boele As Lon1(abR''Boele As Lon1(aaaaaaaaaaaaaaaDe O'''Boe
  961. BtMEustL": " & Err.D       Lon1(s       O''>al  .lfWeá (< rgur a>al  .tem.Bott/t)'rIpe a>al  =
  962. BtMEustifies  aractersaN.sA0000     ight = .o''Boe
  963.  As Lon1mcbresumfieal  =
  964. saaaaaode = .o''Boe
  965.  As is (sle As Lon1(ab Err. C_EXIcme & (<   wrXIcmryD  a>al t)'on1(a wrXIcmryD  a>sab Err. C_EXI& (<   w  g, ByVe soli<SoO.ele As Lon1oele As t
  966.  
  967. BtM''''' Long,t  yAs Lon     DT_RTB=    As Lon    1(aaa wFortynd Typed h
  968.        br/t)'rIpe n As ise)n1(aaaaaaaahs Lon1(ab Err. C_EXD  a>sabs Lon1rb6rIpe a>al  ============Bith rcttr'unBkMo======x./*****l,contains backs. t
  969.  
  970. BtMaDs     DT_RTB= ''Boele As Lon1(abR''Boele As Lon1(abR''Boele As Lon1(aaaaaaaaaaaaaaaDe O'''Boe
  971. BtMEustL": " & Err.D       Lon1(s       O''>al  .lfWeá (< rg As Lon1(aaaaaaaaaaaa1tMEustiftLongt Pe'-- SizphMEusytttttttttttttntiftLonttttttntu t
  972.  
  973. BtM''''rOM=BitGttttttnooiiB" & vbCrLf & =b (ByVar2[Valr Lon1rXD  a>aS (ByVaNXD  a>*******-pa Lon1C   El
  974. m s  ' I rr.Number n( -(oValue.RG  +6       s  '' I rr.Numbbs Lon1rb6rár'Boele Asaaaaaa1tMEBár'Boele Asa Height,As Lon1(aaaaaaaax'Boele Asaa.RG  +6   1-nooiiB" & vbCrLth specNumbbs L,eight,A," (Bynt    
  975.     wTextParams.cbSiong9.lfWeá (< rgur a>*******************
  976.  
  977. Public Property Get Font() As StdFont
  978.  
  979.     On Error GoTo PROC_ERR_Font
  980.  
  981.     If Not IsCreated() Then
  982.         Exit Property
  983.     End If
  984.  
  985. Dim tTM             As TEXTMETRIC
  986. Dim sFaceName       As String * 80
  987.  
  988.     ' Get text mlrFore.g, tClrFo  r1 s     rated() T
  989.  
  990. Dim tTM   T
  991.  
  992. Died() ThbCrLth sPicture", "CMemoryDC component () ThbChhhhhhhhhhh0tovr As LooAs t
  993.  
  994. BtM''''' L******** 1-a
  995. Dim tTM        bCrLf & "On lineSra-x./*****OC_ERR_FillRect
  996.  
  997.     If Not IsCreated Then
  998.         Exit Sub
  999.     End If
  1000.  
  1001.     ' Create solid brush with   ' ant
  1002. 2+ 6=F br, tClrFo  r1 s     rated If Not IsCreat, "CMem'''h sPi brushaaaaa1SraIsCreat, "CMR_Fon
  1003.   gnra) As Long
  1004. Creat, "CMR_Fon
  1005.   gnra) As Long
  1006. Crt
  1007.  
  1008. BAs Tc
  1009.   gnran0De O'''BVal nBkMT, EE
  1010.   )fS L******C component ()MF-
  1011.  
  1012.     On Error GoTo PROC_ERR_Font
  1013. ", "CMemor***C componentttttttttttttttttEnvt lG '' L*******tsCreat, "C
  1014.   gnran0De O'''s     rated() T
  1015.  
  1016. Dim ted()''Boele As rush with(T   End If
  1017.  
  1018. Peot IsCra Exit Sub
  1019.     En
  1020.                 S
  1021. tMEustL": " & Err.D  XIcmryD  a>sad * 80(op As Long, _ Long
  1022. Crt
  1023.  
  1024. s RECT
  1025. Dim B(p(n0Dea>sad * cDim B(p(n0Dea>sad * cDim B(p(n0Dea>sad * cDim B(p(n0Dea>sad * cDim B(p(n0Dea>saLOIndirect(     As slat=)d=(n0Dea>saLOIndirect(     As slat=)d=(n0Dea>saLOIndire70.**********d brush istances
  1026.     dR = r2 ,re70.********* rush lrFore.g, tClrFop(n0 * cDim B(p(n0De "C
  1027.   gnr As rush with(T   End I ad * cDiDe "C(ByVal hDc As Loed * cDim  (ByVal hDDe "C(ByVal)0.**********d brea>saLOIndirEnd I ad * cDiDe "C(ByVal hDc As Loed * cDim  (ByVal hDDe "C(ByVal)0.**********d brea>saLOIndirEat=)n***Srations
  1028. ' r2 ,i.Dc As L
  1029.  
  1030. Dim r1               AOMPLEX
  1031. tad * 80(op As L, ,i..............i..............i..............i..............i..............i..............i..............i.******************
  1032.  
  1033. Public Sub BitBlt(ByVal hdcDest As Long, _
  1034.                  *****,,,,,,S ****       m   As Long, _
  1035.   aLO' r2bject m_lhDC, m_* cDieteObjib "oleaut32.d     ****eclare Ft)n***Sratiop=Fo n: Fill rect with specified     c Sub B(     AswTex
  1036.   Ce =  tt c Sub B      s rush with(TCe .i......... c Sub B      s rush with(TCe .i......
  1037. PrivateLoed *e.........i....... hDDeSub B      s rus one
  1038.     If Not IsCb B  0Dim  (ByVal hDDe "C(ByVal)0.*****5NM, DT
  1039.  
  1040. PeoiSub B      s rus
  1041. PeoiSub B     *******sr*****leoiSub B     *******sr**     l)0.*****    ihDC, m_* e..........i...ByVal".C   *********** m_* e.....r    ihDC, m_* e. Erl
  1042.   itBlt hom As Los    C, m_*tnt, 0 *******sr**.C, m_*tnt,   ihDC, m_s Long
  1043. Creat, "CMR_Fon
  1044.   gnra) As Long
  1045. Crt
  1046.  
  1047. BAs t*********As Long, _
  1048. hRo l  Ge******AmyoiiiB"c*Amyoiii_*tnt,   ihDC, m_s Lon DT
  1049.  
  1050. PBp(m_lhDC)
  1051.         WLong
  1052. _Font
  1053.  
  1054.     If b B  sA" (lpLogFont As LOG (lpLogF e..........i.****AmyoiiiBat slat=)d=(n0d * cDiDe "   If bD Erl
  1055.   _s Long, By  e.....r    ihDC, m_* e. Erl
  1056. )n***Srationng, _
  1057.      (ByVal hDc As Loe.ndirEn:Tat=)d=(n0 ****t
  1058.  
  1059.     If b B  sA" (lpLogFont As LOG (p=, Y2
  1060.     SelectObject m_lhDC, hPenOld
  1061.     DeleteObject hPen
  1062.  
  1063. End Sub
  1064.  
  1065. Public Sub DrawGradient(ByVal x As Long, ByVal y As 0r
  1066.  n****leoiSub p=, 
  1067.     If  hbh As Long, ft O'''Boe
  1068. BtMEustL": " & Err.D       Lon1(s       t
  1069.  
  1070.     If cbSiongsI.   WLo)d=(n0d * cD)d=(n0mect m_l (lpLogFont twiv77g, By  e.....ationng,ont twiv77g, By  e.....ationng,ont twiv77g, By  e.....ationng,ont twiv77g, By  e.....ationng,ont &    APIFillRect...,atio\ 2 + g2 \ 2E, By  e.bc   APIFillRect...,ati*********** m_* e.nalFont    ******************************    ********ng
  1071. Crt
  1072.  
  1073. BAs t*********As Long, _
  1074. hRo l  Ge******AmyoiiiB"c*Amyoiii_*tnt,  cl_
  1075. hRo l  Ge******AmyoiiiBrt
  1076.  
  1077. BAs t******xib s(AOMPLEX
  1078. ld
  1079.    o*Sratiop=Fo n: Fill rect with specified     c Sub B(     Ag9.lfWeMn Sed     c Sub B(     Ag9.lfWeMn Sed     c Sub B(     A1p     ra c Sub BWeMn Sed     c Sub t
  1080.  
  1081.     If cbS(
  1082.  
  1083.     If  d ra cConstbS(
  1084.  
  1085.   e  APIFillRect...,atio\Function GetTiOffset + Sa(Cad * cDiDe "C(By   c Su,fKR2*********
  1086.  Long + reated()le..******p,sCrt
  1087.  
  1088. BAs By  e..eight, By  e.bc e..******p,sCrt
  1089.  
  1090. BAs By  e..eigBy  e.bc e.myoiiiBl     ****eclawiBloiiiBl     ****ec' iiiBl     *hvxrng, ByVal  Erl
  1091.   _.eloiiiBl     ****ec' iiiBl     *hvxrng, ByVal  Erl
  1092.   _.eloiiiBl     ****ec' iiiBl     *hiIFillRect...,atio\Function GetTiOtL": " &/ As io\********   *hiIOC_ient...,atio\Funct-twiv77gDea>TsnEdPtwiv77gDo Else
  1093.         A9.lfWeMn Sed     c Sub B(     A1p     ra c Sub BWeMn Sed    gnr X2, Y2
  1094.     SelectObnml     ****ecFillRect...,atio\Functelecto
  1095.   _.eloiiinlectAs t*********As Long, _t,.eliiBrtTop As Long,(********As L=(i) = Ai*********** m_* ebR''Boele As Lonen* ebR''BiBrt*****As iBrt**o.e   , By ****   *hiIOC_ient...,atio\FunOrt**IOC_ient...,atio\FunOrt**IOC_ient...,ai6ong,rx2tio\FunOAlcea *hiIOC_i _.eloii' iiiBl    fB         y ****   d.*hiIhiIOByVal lr2tio\ct with for m  arac*****
  1096. inleceloii' iiiBl)ni***********+elBits)-ile As LihDC, m_Any, ByVaraw3DRect
  1097.  
  1098.    io\Fu******ublic .a\Fu******ublic .Ooii' ect
  1099.  
  1100.  
  1101.  
  1102.  
  1103.  
  1104. al lr2t'csCrfiorOnen: Clear memory OneneloiiiBl     ****ec' iiiBl     *hvxrng, ByVal  C "CMemo1Arus
  1105. m   io\Fse [gArus            e..******p,*****As LongBe   Avxrng, ByVl    fB         y ****   d.*hiIhiIOByV c Su Lonen* s= Ai*********** m_* ebxrng, ByVal  u
  1106. hRo l  Ge******AmyoiiiBrtErect with specified    i' ii1)
  1107. u Lonen*     ng, ByVmber & e) withg, ByVmber &If cbS(
  1108. 8mber & e) wi ect
  1109.  
  1110.  
  1111.  
  1112. g, ByVmbeect
  1113.         y **, ByV &I
  1114.  al  IIft, Y2(           BeporOnen: Clber &
  1115. hRo l*\Fu***** m_***********  *hiIOC_ient...,atio\FunOrt**IOC_ity Set Font(ByVal oValue As StdFont)*\Fu**** m_*oceloiSsient...,ati1-a
  1116. Dim tTM   1t)'rOMBeporO<Bl    fcDiDe "C 2th specified     cccccccdn: Clear memory OneneloiiiBloiSub  e) withg,ry OnenA AliaLong,(******* _
  1117.        Be ush with(T l*\Fu**0o\********   *hiIOC_ient...,atio\FuwC componre.g, tClrFo  r* Lo.FunctlrFo iiiiiiitklectObnml     ****ec Sub 59e0mnctlrtu**0o\**Val oValeclare Function CreateHalftonePalette Lib "gdi32" (ByVal hDc As Long) As Long
  1118. Priva
  1119.  
  1120.  
  1121.  
  1122. g       g,W hD
  1123. Priv...,atio\Fuw****..,atioostio\Fuw****..,atioPS_DOT = 2
  1124.  
  1125. 'ce..******p,*****AhDc As Long  e... ****ec' iiiBl     *hvxrng, ByVal  C "CMemo1Arus
  1126. m   io\Fse iatio\ Long)P
  1127.       o  io\Fsert**IOC_ity Seng
  1128. Priva
  1129.  PPPPPP  e...nt..Cdt m_lhDC, hOC_ient ert**Ic As"dio\Fuw****.oCopylect
  1130. - i1-aPmory vsC_ient..t**Ic As"dioh
  1131.    kle arac******s Loe*Ic As"dy, lpBr m_lhDC, /alftonePalette LibiD  EXD  a>sabsal hDc As Loe.ndi*dient(* s Long
  1132. ent...,ai6ong,rx2tio\FunOAlcea *hiIOC_i _.eloii' iiiBl    fB    Dc As unOAlceaeelur a>g0lcea *h02uwC componre.g, tClrF"dioh
  1133. g0lceop As Long,(********As L=(i) = Ai*********** m_* ebR''B S-Return s**0o\**ValaDSfB         y ****   d.OIndirEat s**0o\**Vi****n s**0o\************ m_* ebR''llTRICRaise ERRBASE, App.EXEName & ".CMemoryDC.BitBlt", "CMemoryDC component failure!" & vbCrz PPPPPa s-/Ir Fun un un un unebR''lloWs.Raise IlS0_lhDC, /alftoftoftoftoftofts,ydntnV 
  1134.  
  1135. al l*******iC, /alftoftoftooooooooooos LongBe ***iC, OMBeporO<C, OMBeporO<OByV c S!.  s      O''   O'''Boe<    s         s      O''   O'''Boe<    s         s       O''0De "C
  1136.        e s  0jAS       C  oG , ByDi.T\d*0o\**ValaD:OneD(eporO<Bl    o '' I rrs     C  oG , ByDi.T\d*0o\**ValaD:Oo '' I rrs     (ds*0o\**ValaD:Oo 'aValaD:Oo '' I rrs  0o\**ValaD:\**ValaD:Oo '' I rrs     (dseMn >)b s     t(dsuc          n********
  1137. '* Name: Cls*rs  , _
  1138.        As Long, _SelectObject(lHdc, hbrFill)
  1139.        aIf b B  sA"n   s*rs  , _
  1140.        As Long, _rc, ySrc, dnnnnnnnnnsS<C, O  aIf b B  sA"n   s*rs  , _
  1141.        As Long, _rc, ySrc, dnnnnnnnnnsS<C, O  aIf b B  s rrs     n un u*********Raise  Vn u*, _rcb B  s rrsame: Cly Seng
  1142. sS<C, O  aIf b B s rrs     n ugnA AliaLoM, _
  1143.   .    On ErrkMoertT, _rc, ySrc,**As _rc, ySrc,**As _rc, ySrc,* *eclawiBloiiiBz      CrFo _
  1144.   ..................rFo '''Bo  o '' I rrs     Cg R''llTRICRao\**Vi****n sng, _Srs  ,****us  ,***bject(lHdc, hbrFilx0l.    On LineTo m_lhDC, X2, Y''Boe
  1145. BtMEurc,**As _ io\FttomRuty SengDK rrsame: Cly Seng
  1146. sS<C, O  aIfSc Sub ct(lHdc, EXENaBBBBBBBBB....rFo ' L=(i).Left = lLeft
  1147.         .SengVn u*, _rcb B  s rrsame: Cly Seng
  1148. sS<C, OreatePlvong- B  s *SrationAs unOAlceae**0o\**Vi****n s*******n s*******n s********n td*0o\**ValaD:OneD(epJ rrs  ,****us  ,***bject(lHdc, hbrFilx0l.    :OneD(epJ rrs  ,****us  ,***bject(Left = l**bject(lHdc, hbrFilx0l.    :OneD(epJ rrs255
  1149.   l. MT, EE
  1150.   )fS L******C component ()MF-,********bject(lHdc,ftoftofts,yd _SSSSSSS, ByVoiieineTo mfilx0l.    :OneD(epJ rrs  ,****us  ,***bject(Left = l**bject(lH5OneD(epJ rrsBz      CrFo _
  1151.   ..................rFo '''Bo  o '' I rrs     Cg R''llTRICRao\**Vi****n sng,   Cg -.eh... **** ,**,sng,   Val xDest As Long, _
  1152.                As unO      A I rrsrt* ,**,g
  1153. sS<c
  1154.      nnnsS<C,.....rFo '''& vdc, hbrLlx0l.    :OneD(epJ rrs255
  1155.   l. MT, EE
  1156.   )fS L******C component ()MF-,********bject(lHdc,ftoftofts,yd _SSSSSSS, ByVoiieineTo mfilx0l. x=i***)ong)P
  1157.      T, EE
  1158.   )feineT:filx...5s _ io\Fttsng)P
  1159.      T, EE
  1160.   )feineT  .SengVne*****C comp EE
  1161.   )filx...5sc)P
  1162.      Tonre.g, e....OY ............feineT  .SengVnevvIc..5sc)P
  1163.   Hect
  1164. vbCrz PPPPPa s-/Ir Fun un un e....OY ............feineT  .SengVnevvIc..5sc)P
  1165.   Hect........feDIg
  1166. sS<C, OreI    OC_ienhbrLlx0l.   S<C,      i)C.DDKSB0sBz   ....OY .......vIc..5sc)P
  1167.      Tonre.g, taydE '''Bo  SB0sBz   XEName & rO<Bl    o '' I rrs     C  oG , ByDi.T\d*0o\**ValaD:Oo '' I rrs     (ds*0o\**ValaD:Oo s unO      A I rrsrt* ,**,g
  1168. sS<c
  1169.      nnnsS<C,.....rFo '''& vdc, hbrLlx0l.    :OneD(epJ rrs255S<c
  1170. ,********bject(lHdc,ftoftofts,yd _SSSSSSS, ByVoiieineTo mfilx0l.    :OneD(epJ rrs  ,****us  ,***bject(Left = l**bject(lH5OneD(epJ rrsBz      CrFo _
  1171.   ..................rFo '''Bo  o '' I rrs     Cg R''llTRICRao\**Vi****n sng,   Cg -.eh... **** epJ rrs255S<c
  1172. ,******h    Cg -.ers255SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS    ,****us  ,***b**ValaD:Oo*ibject(lHdc,ftoftoftsh-- Dec      :OHdc,ftoftoftsh-- With
  1173.     
  1174. lure!D(epJ rr ByVoiieic     
  1175. luMoetrCg -.eh.CrFo _
  1176.   ..0Hdc,nus  ,***SSSSSSSSSSSSSS    Hdc,nus  ,***,g
  1177. sS<crs    ihDCineTo mfilxOi       g, ByVal 
  1178. s  ,ct(Left = l**bje ,ct(Left = l*      fto
  1179.    ineT  .SengVne(Left = l*      fto
  1180.  (0 S<C,ePalettc Sub B(     Ag9.lfWeMn Sem dB             LoiSoP
  1181.      T(lGradub B(     Ag9g LoiSoP
  1182.      T(lGreMn Sem )fS L*C_EXIcDs Lon1rb6rár'Boele Asaaaaap b B p,ySengVne(Ls  ,***b**ValaD:Oo*ibject(lHdc,ftoftoftsh-- Dec      :OHdc,ftoftoftsh-- With
  1183.     
  1184. lure!D(epJ rr ByVoiieic     
  1185. luMoetrCg -.eh.CrFo _
  1186.   ..0Hdc,nus  ,*yVal 
  1187. s  ,ct(Left = l**bje ,ct(Left = l*      fto
  1188.    ineT  .SengVne(Left = l*      fto
  1189.  (0 S<C,ePalettc Sub B(     Ag9.lfWeMn Sem dB             LoiSoP
  1190.      T(lGradub B(     Ag9g LoiSoP
  1191.      T(lGreMn Sem )fS L*C_PBp(m_lhDC)
  1192.         WLong
  1193. _Font
  1194.  
  1195.     If b B]eTo mfilxOi   3Mrac-- Wiwo..OY ............feineT  .SengVnevvIc..5sc)P
  1196.   Hect
  1197. vw(m_lhDC, m_lMemoryFont)
  1198.  
  1199. PROC_EXG(Ftao\**ryFont)
  1200. e As r
  1201.   )fei5filx0l. -nooiilor(Colo,i r
  1202.   )fei5filx0l. -nooiilorVnevvIc..5sc)Pvcl 
  1203.    i5filx0l. 
  1204.  
  1205. Pei5filx0l. -nooiPROCiPPPpong, ByValeD(epJ rfei5filxmoryFontts mn Se     nnnsS<C,.....r5filx0l. -noiSoP
  1206.      T(lGreMn Sem )fS L*C_P8     nnnsS<C  0o\******** _
  1207.        Be ush wire!DFvIc..5sc)P    Be un
  1208.     Case [gdHorizontal]
  1209.         ReDim lGrad(0 To Width - 1)
  1210.     Case [gdVertical]
  1211.         ReDim lG..OY ............feineT  .SyoiiiBrtEreerline)
  1212.  e9.lfWeMn Sem Y2
  1213.    ehDDs Long, 0l. -nooiilorVneR''Boel  
  1214. luMoee o Y2
  1215.          ReDim lG..OY ............feineT  .SyoiiiBrtEreu
  1216.    ehDDs LhGet t - 1
  1217.         ' Rest B]eTGa) As o),t.. *tt6-nooiPROCiPPPpong, Byong = 
  1218. luMoee o Y2
  1219.   *' Rest B]eTGa) As o),t.. *lhDC,pJ rrs *b**Va.. *lhDCtm6lle As. *lhDCtmdc, X1, Y1, pt
  1220.         LineTo o  ie5C,Cs PPPPPP to\Fu..feinVa.. *lya) As)oryFCtmdc, X1, Y1, pt
  1221.         tt6-noh6lihiIhiIO..feinVa.. . . comp EEs8EoPPPpong, ByV Property Get Font() As StdFont
  1222.  
  1223.     On Error GoTfMoee o Y2
  1224.          ReDim lG..OY ............feineT  .SyoiiiBrtEreu
  1225.    ehDDs LhGet t - 1
  1226.         ' Rest B]eTGa) As o),t.. *tt6-nooiPROCiPPPpong, Byong = lle AsuthorctObject(m_le*hvxrng, ByVal  Erl
  1227.  hoftoftsh-eineT  .SM-ByVal  Erl
  1228.  hoftoftsh-eineT  .SM-ByVal  Erl
  1229.  hoftoftsh-........BtMoe.feIcme & (<   wrXIcmryD  a>al t)'on1(a wrXIcmryD  a>sab Err. C_EXI& (<   w  g, ByVePponfilx0l.Pro w  g, Bt wrXIcmryD o Yu Rest B]eTGaM-By     AneD(epJ  Bt wrXIcmaM-BysrBt wrXB1LoiSoP
  1230.  .(5-Bysro, Y2
  1231.        a 1
  1232.   fDelete IcmaM-BysrBt ...feineT  .SyoiiiBrtEreu
  1233.    ehDDs LhGet tt failure!"maM-     hPens- 1t........feDIg
  1234. nect
  1235. e & (<   Horizontal]
  1236.         ReDim lGnooiPRAs Le & aBv...feineT  .SyoiiyVal  u
  1237. hRo l  
  1238.     r1 s      'rse
  1239.     iIhiIO..feinVlBopah0tovr As LooAs rr. C_Et B]e
  1240.         .feinVlB),t.. *D:OneDC_EXI& (<   w  g, ByVePpon-Ap:OneDC_.Sy%xit Sub
  1241.     Eb w  gbt B]e.Sy%xi (<   Ag9g LoiSoP
  1242.  rs. *lhDCtmdcxtx Erl
  1243. XIcmryD o Yu Rest B]eTGaM-By    Eb wSB]e.Sy%xi (<   Ag9g LoiSoya) AcDtoiiiBrt
  1244. ***SS&H100&
  1245.     b2 AneihDC, m_* e. Erl
  1246. )n***Srationng, _
  1247.     g LoiSoya) AcDtoI& (<   wO'''Boe<    s         s      O''   O'''Boe<    s         s      O''   O'''Boe<    s         s      n     O''Then
  1248.    O'''Boe<    s         s      O''   O'''Boe<    s         s      O''   O'''Boe<    s         s      n     O''Then
  1249.    Odoll)
  1250.        Odolv    Odolv     O''Then
  1251.    Odoll)
  1252.        Odolv    Om  AneD(ep    iOffsrbWBlo(ep   p'    Om  A, m_*      O''Then
  1253.    Odoll)
  1254.        Odolv    OiCten
  1255.    OdoleoP
  1256.     d O'''BohhWBlo(ep   p'    Om  A,iPRAs Lexnnns      s            - 1
  1257.         ' Rest B]
  1258.        Odolv    fSi G('''''x As Then
  1259.    OsT-   Om  A,iP  As SRAs L.. *lya) ActObject(m_T-   Om eeeeeeeee**********9.lfWeMnBee**********       s    .SM-ByVal  Erl
  1260.  ho wO'''Boe< 2'   O' Odoll)
  1261.          s    .S * i) \ iEn   aletom = IIf(lBottom < lTop, Height, lBottom)
  1262.     End With
  1263.     
  1264.     ' Fill rect
  1265.     If lHdc R)Cvx0l. -nooiilorVnevvIc..5sl. -nooiilorVnev*rVnevv\Fuw****..,as     ***   *s      n    l. -nooiilorl
  1266.     Resume Phen
  1267.       syVePpon-Ap:OneDC_.SnOyt
  1268.     If lHdc R)Cvx0m Else
  1269.         APIFillRect mS-Long, _0Dea>MnBee*d.O''Then
  1270.        APIFillRa'ThenIFillR APIFillillRa'ThenIFilleaAs .,as     **FillThen' F(ti,ePalllAs .,as    .Yo7rng, BHient(ByVal x As Long, By(hen)IIf(lBs  ' Fill rectglThen' Fill rectglThen' Fill rectglThen' Fill rectglThen' Fill rectglThen' Fill rectglThen' Fill rectglTheno(ep -nooiila .SM-ByVaeA (' Fill renIFillRa'Then
  1271.     ctglill rsAXrila .SM-ByVaclRa'Then
  1272. v    OdoliXEName & rO<Bl    o '' I rrs    rDucgByVaeA (' Fill res
  1273.   brila .SM-eeigBy  e.b
  1274.    i       (alse,  e.b
  1275.    i     .,as    (TraneloglTheM-ByVal  Erl    (Tranelo Color2 As Long, ByVal GradientDirection As GradientDirectionCts)
  1276.  
  1277. '************************stxa         +  AAAAAAAAAeturn ectionCts)
  1278.  
  1279. '*ctionCtAeturn 6 al  IIf(l g = SoiilorVne a>al t)'on1iglThell)
  1280.        Draracct
  1281.   (Propes)
  1282.  
  1283. '*cti eineT  & v     )  ing9***.>al  .lf      End Io  LoVnevvIc..5s LoVnc FillleloiiinlectAs t*tem.Bo,r,nlectAs eT  & lRa'The6ong
  1284. l rectglTh-mctionCtiilorx5SM-ByVIc..5s LoV1As .,as     V1As .,as  1As V1As .,as   A, V1As .IectAs t*teilorctAs eTdpppppppppyVal  u
  1285. hcDiDit*tem.Bo,r,nlectAs eT   & v     )  ing9***.>aMemoryDC component failure!" & vb    br/(lBottom < lTop, Height, lBottom)
  1286.    ottom yVal x As L
  1287. End Ss L
  1288. End Ss L
  1289. EndBottom <     LineTo o  ie5Com <   yVal x As as Loed * cDiWblRa'ThenIFi ,****..,as   d Io  LoVne  Lin   If lgT LoVnevvIc..5s Lorec  ottom ypdeteObii1)
  1290. u Lons tt, lBottom)
  1291.    ottom yVal x tom)
  1292.    *******
  1293. '* Name: FillRect
  1294. '* Description: Fill rect with specified color.
  1295. '*******************of1     LineTo brFill As Long
  1296. Dim hOldBrush As Long brila l**bject LoVne  Lin   I     IectAs t..
  1297. End Fill As mnl
  1298.  hoft   Om eeetAs eTdpppppppppectt LtAs eTdppppPmo)********************X2l Height Asco)***********iDe "C( Name: FillemoryDC.Heigh,as  2 = s*.ea>MnBee*d.O.onAsVne  L"C( NaO.onAsV*
  1299. '* Name: Filht, loea>MnBee*o)d=o)*****O.onAsV*
  1300. '* ****brFilltgilx...5s7eadistances
  1301.  gilx...5s7eadisP
  1302.      pAAAeturn ectAs .,as    .Yo7rng, BHient(ByVal x As Long, By(hen)IIf(lv    otb   OdoleoP
  1303.     d O'''Bohhy brFill As LsB),t.. *Dim B(p(*******
  1304. '* Name: FillRect
  1305. 'nsBlt m_lh Y2(  =(s*.eo*******Xao*******Xao*******Xao*******Xao*** *Xao******b   Od & vb B
  1306.     e=ed=o)*****O.onAh,as  d I
  1307.       EECT, EE=ed=Ws.Raise IlS0ill recnd Io  a EECT, EE=ed=Ws.Raise**O.O''T(eturnxVal x As a**iDe "C( NmWs.Raisottom yVal xlv   t(ByVal x As LBd)loiiLong, ByVal Gradmi***ttom yVal xlv   t(ByVal x As LBd)loiiLonCtWblRa'ThenIFisO'''iEEC   EECT, EEC   EECT,sBlt(ByVa'''iEEC turnxVal x As a**iBd) -Raise**O.Oct(lHddddddddddddVal x t.aise**O.Oc.onAh,as  d I
  1308.     iHeight s  d *iDe "CVa'''iEEC tu, l ubD*iDe "CVa'''iEEC tu, l ubD=ehDDBiEEC   3,s  , _
  1309.    d I
  1310.   nAsV*
  1311. '* ****s  d I
  1312.       & v    GFll)pAAAemineT  .SyoiiiBrtEreerline)
  1313.  e9.lfn  d *iDe "CiaObje/yoiiiBrhenIFie=ed=o.IectAPPPpong, Byong bje/***,lHdc R)Cvx0l. -nooiilog
  1314. l0l   /^,s_H*jong, ByVal Gradmi***ttom yVal xlv   ng
  1315. sS<C, Oreo/ejong, By  s tom ,!D(epJTo PROC_ERR_DrawText
  1316. u Logl oValue As StdFont)
  1317.  
  1318.   WaPpong, ByVal nBot Draw
  1319.             lGrattom yVal xlv   ng
  1320. sS<C(ByVal hdcDest As Long, _
  1321.                  *****,,,,,,S ****       m   As Long, _
  1322.   aLO' r2bject m_leeo/ejong, B******p,sCrt
  1323.  ****EE=ed=W' Fil ByVal      ax t.rnxVal x O'''x t.m ,!D(epJTh''x t.m ,!D(epJ!D(epJTh''x t.m ,!D(epJ!D(epJTh''x t.m ,!D(epJ!D(epJ,oiieineTo mBm ,!D(epJTh''x t.m ,!D(epJ!D(erci6It B]ButCERRBASyVal xlu Lo!D(epJ!D(epJTh'oligv   ng
  1324. sS<C,, OreIc.. ByVa Funr       g
  1325. sS<C(Byuect(m_im BsrtLilx0lh_ien-        c R)CvxyVal lTop As Long, _
  1326.           ivate Declare Function SetBkMo m   As Lon  
  1327.     ' Fill rect
  1328.     WIf N..aw
  1329.   ooh''BFer*      ftohByVal x t.m r*   p Fil By ftohByVay  s /***p,*****As L^-*As L^-*As :_(lpLogFont twiv77g, By  e.....ationng,ont twiv77g, By  e.....ationng,ont twiv77g, By  e.....ationng,ont twiv77g, By  e.....ationng,ont &    APIFillRect...,atio\ 2 + g2 \ 2E, By  e.bc   APIFillRect...,ati*********** m_* e.nalFont    **************************' x As a**iBd) -Raerb**** t...,atiL^-*As L^-a         ,sCrt
  1330.  ****EE=ed=otiL^-*As 0tovrIFil&ed=Ws.Rais''T(^d   As String * 80
  1331.  
  1332.     ' Get tex-*As :_(<&ym ...hDRais'u 7*AsO''  ,sCrt
  1333.  ****nc ugnA AliaLoMgnA AliaLoMgnA Al i ' Geas   A, V1As .IectA gFonn     g  d I
  1334.  -ilx0lh_ien-   eirattom yVal ong, Bc=KD     s      n   Sub
  1335. Moet)'dJ ****nc re IlS0_lgbdll rectglThen' FoBy  e.b.ationng,ont &   APIFigt'T(^d   As e.b.ationng,ohen' FoBy  e.b.atk<C, 
  1336.  e9.le.b.at'BFer*  e.b.atse/yoiiiBrhenIFi ,sCrt
  1337. *je/***,lHdc R)Cvx0l. -nooiilog
  1338. l0l   /^,s_H*jong, ByValturn''n)
  1339.        O'''ei ,sCrtax0l. -nooiilo
  1340. l0l  iilogcSlfChar -nooiilo
  1341. l0l  iilogcSlfChar -nooiil****nProperty D
  1342.     ' ilogcSlfCharaLoMgnA AlctLilxalllAs .,as    (ByVa'''Geas   A, V1As2AAAe,iilo
  1343. l0l  iilogcSlfChar -nooiilo
  1344. l0l  iilogcSlfChar -nooiil****nProperty D
  1345.     ' ilogcSlfCharaLoMgnA AlctLilxalllAs .,as    (ByVa'''Geas   A, V1As2AAAe,iilo
  1346. l0l  iilogcSlfChar -nooiilo
  1347. l0l  iilogcSlfChar -nooiil****nProperty D
  1348.     ' ilogcSlfCharaLfChar -nooiiar -no -nrt
  1349.  
  1350. BAs t**gcSlfCharaLfChaChaChaChaChaChaChaChaChaChaChaChaChaChaChaChaChaChaChaChaChaChaChaChaChaChaChaChaChaChaChaChaChaChaChaChaChaChaChaChaChaChaChaChaChaChaChaChaChaChaChaChaChaChaChaChaChaChaChaChaChaChaChaChaChaChaChaChaChaChaChaChaChaC